package com.gjp.jooqspringboot.service;

import com.gjp.jooqspringboot.bean.User;
import com.gjp.jooqspringboot.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Gjp on 2018/7/25.
 */
@Service
public class UserService {

	@Autowired
	UserDao testDao;

	public User insert(User user) {
		return testDao.insert(user);
	}

	public User update(User user) {
		return testDao.update(user);
	}

	public boolean delete(User user) {
		return testDao.delete(user);
	}

	public User selectById(User user) {
		return testDao.selectById(user);
	}

	public List<User> selectAll() {
		return testDao.selectAll();
	}

	public List<User> selectPage(Integer page, Integer size) {
		if (page < 1) page = 1;	//最少一页
		if (size < 1) size = 10;//默认10条
		return testDao.selectPage(page,size);
	}

	public String transcationTest() {
		return testDao.transcationTest();
	}
}
